-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RPC protocol to Peer #394
Conversation
Currently, observability interceptors must parse the `Content-Type` header to determine which RPC protocol is in use. This isn't awful, but it's so easy for `connect-go` to expose directly that we might as well. I chose to use our own strings rather than repurposing OpenTelemetry's semantic conventions here. The OTel strings are less nice in this context, and the packages are all unstable and subject to change. @joshcarp, LMK if this seems like a bad tradeoff to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it a lot
So I actually already derived this on my own, so this is a nice addition I can use. Would it make sense to move it to it's own type/enum? Something like: type Protocol string
const (
ProtocolConnect = Protocol("connect")
...
) or whatever? Might make it easier to use for folks trying to consume this (like me). |
I'd rather not make a separate type, but I'm happy to do some enum-named constants! From this codebase's perspective, I don't think named types are worth the API surface, since they don't stop us from mistakenly passing around string literals. I can see the utility of having them in code consuming these strings, but I'll leave that up to the consumer. |
I think a named constant would at least be useful. :) |
Export constants for the three currently-supported protocols. This commit also simplifies the implementation a bit: there's no need to make the protocol name part of the internal `protocol` interface quite yet.
Currently, observability interceptors must parse the `Content-Type` header to determine which RPC protocol is in use. This isn't awful, but it's so easy for `connect-go` to expose directly that we might as well. I chose to use our own strings rather than repurposing OpenTelemetry's semantic conventions here. The OTel strings are less nice in this context, and the packages are all unstable and subject to change. @joshcarp, LMK if this seems like a bad tradeoff to you.
Currently, observability interceptors must parse the
Content-Type
header to determine which RPC protocol is in use. This isn't awful, but
it's so easy for
connect-go
to expose directly that we might as well.I chose to use our own strings rather than repurposing OpenTelemetry's
semantic conventions here. The OTel strings are less nice in this
context, and the packages are all unstable and subject to change.
@joshcarp, LMK if this seems like a bad tradeoff to you.